import request from '@/utils/request'
import qs from 'qs'

export function login(data) {
  // console.log('login', data)
  // console.log('login', qs.stringify(data))

  // request.post('/login',JSON.stringify( {
  //   username: data.username,
  //   password: data.password
  // })).then(res => {
  //   console.log(res)
  // })
  return request({
    // url: '/vue-element-admin/user/login',
    // url: '/login?username=admin&password=111111',
    url: '/login',
    method: 'post',
    // data: qs.stringify(data),
    data: data,
    // headers: {
    //   'Content-Type': 'application/x-www-form-urlencoded'
    // }
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
